<template>
  <div class="swiper-wrap">
    <swiper ref="mySwiper" :options="swiperOptions" class="swiper">
        <swiper-slide>Slide 1</swiper-slide>
        <swiper-slide>Slide 2</swiper-slide>
        <swiper-slide>Slide 3</swiper-slide>
        <swiper-slide>Slide 4</swiper-slide>
        <swiper-slide>Slide 5</swiper-slide>
        <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>
<script>
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'
export default {
  components: {
    Swiper,
    SwiperSlide
  },
  data () {
    return {
      swiperOptions: {
        autoplay: {
          delay: 3000,
          disableOnInteraction: false
        },
        loop: true
      }
    }
  },
  activated () {
    if (this.swiper && this.swiper.autoplay.paused) {
      this.swiper.autoplay.run()
    }
  },
  computed: {
    swiper () {
      return this.$refs.mySwiper.$swiper
    }
  },
  mounted () {
    // this.swiper.slideTo(3, 1000, false)
  }
}
</script>
<style lang="scss" scoped>
.swiper-wrap {
  background: #fff;
  padding: 0px 18px 0;
  .swiper {
    display: flex;
    align-items: center;
    justify-content: center;
    background: green;
    height: 86px;
    border-radius: 10px;
    color: #fff;
    font-weight: bold;
    font-size: 30px;
  }
}
</style>
